home *** CD-ROM | disk | FTP | other *** search
/ Aminet 34 / Aminet 34 (2000)(Schatztruhe)[!][Dec 1999].iso / Aminet / util / gnu / unixcmds.lha / unixcmds / src / strcmp.c < prev    next >
Encoding:
C/C++ Source or Header  |  1999-10-06  |  616 b   |  33 lines

  1.  
  2. #include <string.h>
  3. #include <stdlib.h>
  4. #include <stdio.h>
  5.  
  6. /* simple string comparison, I made it because the amigashell IF EQ
  7.    is not case sensitive, and it can be annoying sometimes */
  8.  
  9. /* Returns 5 if strings are not equal, 0 otherwise */
  10.  
  11. int main (int argc, char **argv);
  12.  
  13. int main(argc, argv)
  14. /* [<][>][^][v][top][bottom][index][help] */
  15. int argc;
  16. char *argv[];
  17. {
  18.   int ret=0;
  19.  
  20.   /* Check for the correct number of arguments. */
  21.   if (argc < 2) {
  22.         fprintf(stderr, "Usage: strcmp <string1> <string2>\n");
  23.         exit(1);
  24.   }
  25.  
  26.  if (strcmp(argv[1],argv[2]))
  27.  {
  28.    ret=5; /* WARN */
  29.  }
  30.  
  31.  return ret;
  32. }
  33.